package com.example.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.beans.IntrospectionException;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/test")
public class TestController {
    @RequestMapping("/1")
    public String Test1(){
        return "forward:/main.html";
    }
    @RequestMapping("/2")
    public String Test2(){
        return "redirect:/main.html";
    }

    @RequestMapping("/3")
    @ResponseBody
    public String Test3(){
        return "redirect:/main.html";
    }

    @RequestMapping("/4")
    @ResponseBody
    public Object Test4(){
        Map<Integer,String> map = new HashMap<>();
        map.put(1,"aaa");
        map.put(2,"bbb");
        map.put(3,"真理");
        return map;
    }

    @RequestMapping("/5_1")
    @ResponseBody
    public String Test5_1(){
        return null;
    }

    @RequestMapping("/5_2")
    @ResponseBody
    public Object Test5_2(){
        return null;
    }
}
